/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package deatax.card;

import java.util.HashMap;

/**
 *
 * @author pson
 */
public class CardManager {
    
    private HashMap<String, CardEffect> effects;
    private HashMap<String, Card> cards;
    
    private HashMap<String, CardPile> pile;
    

    public CardManager() {
        effects = new HashMap<String, CardEffect>();
        cards = new HashMap<String, Card>();
        pile = new HashMap<String, CardPile>();
    }
    
    public void addEffect(String name, CardEffect effect) {
        effects.put(name, effect);
    }

    public HashMap<String, CardEffect> getEffects() {
        return effects;
    }

    public void setEffects(HashMap<String, CardEffect> effects) {
        this.effects = effects;
    }

    public Card get(String card) {
        return cards.get(card);
    }
    public HashMap<String, Card> getCards() {
        return cards;
    }
    
    public void addCard(String name, Card c) {
        cards.put(name, c);
        if (!pile.containsKey(c.getType())) {
            pile.put(c.getType(), new CardPile());
        }
        pile.get(c.getType()).addCard(c);
    }
    
    public void shuffleCards(String name) {
        pile.get(name).shuffle();
    }
    
    
    public Card drawCard(String name) {
        return pile.get(name).draw();
    }
    
        
}
